/** <a href="http://www.cpupk.com/decompiler">Eclipse Class Decompiler</a> plugin, Copyright (c) 2017 Chen Chao. **/
package com.minierp.controller;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.minierp.bean.BbsArticleBean;
import com.minierp.bean.ClieUserBean;
import com.minierp.bean.LicenseInfo;
import com.minierp.bean.OrderParameterCarrier;
import com.minierp.bean.QueryParameterCarrier;
import com.minierp.bean.QueryResult;
import com.minierp.bean.UserBean;
import com.minierp.bean.UserStatus;
import com.minierp.dao.BbsArticleDao;
import com.minierp.dao.BbsColumnDao;
import com.minierp.dao.BusinessBillDao;
import com.minierp.dao.DepartmentDao;
import com.minierp.dao.EnterpriseInfoDao;
import com.minierp.dao.EstablishmentCommunicateDao;
import com.minierp.dao.IdGenerator;
import com.minierp.dao.MessageDao;
import com.minierp.dao.QueryDao;
import com.minierp.dao.SystemLogDao;
import com.minierp.dao.TallySetDao;
import com.minierp.err.PermissionDennyException;
import com.minierp.helper.BarcodeHelper;
import com.minierp.helper.EncCommonHelper;
import com.minierp.helper.EncInterceptorHelper;
import com.minierp.helper.PageHelper;
import com.minierp.listener.OnlineListener;
import com.minierp.model.BbsArticle;
import com.minierp.model.BbsColumn;
import com.minierp.model.DownloadLog;
import com.minierp.model.EnterpriseInfo;
import com.minierp.model.Message;
import com.minierp.model.SystemLog;
import com.minierp.model.TallySet;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Vector;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

public class CommonMACtr extends MultiActionController {
	private MessageDao messageDao;
	private BbsArticleDao bbsArticleDao;
	private BbsColumnDao bbsColumnDao;
	private EnterpriseInfoDao enterpriseInfoDao;
	private DepartmentDao departmentDao;
	private EstablishmentCommunicateDao establishmentCommunicateDao;
	private TallySetDao tallySetDao;
	private SystemLogDao systemLogDao;
	private BusinessBillDao businessBillDao;
	private QueryDao queryDao;
	private IdGenerator idGenerator;
	private String mainView;
	private String topMenuView;
	private String leftMenuView;
	private String footView;
	private String desktopMsgView;
	private String desktopFlowView;
	private String loginBridgeView;
	private String logoutView;
	private String modalDialogView;
	private String modalDialogSuccessView;
	private String calendarSelectView;
	private String spellSelectView;
	private String onlineListView;
	private String systemLogListView;
	private String systemMainView;
	private String baseMainView;
	private String financeMainView;
	private String makeMainView;
	private String businessMainView;
	private String storehouseMainView;
	private String purchaseMainView;
	private String smsMainView;
	private String cooperMainView;
	private String cancelLogListView;
	private String aboutEkingView;
	private String cancelReasonView;
	private String reportMainView;
	private String appBarcodeView;
	private String impoSuccessView;
	private String onlineLoginBridgeView;
	private String onlineMainView;
	private String onlineDesktopView;
	private String cutImgFormView;

	public String getCutImgFormView() {
		return this.cutImgFormView;
	}

	public void setCutImgFormView(String cutImgFormView) {
		this.cutImgFormView = cutImgFormView;
	}

	public BusinessBillDao getBusinessBillDao() {
		return this.businessBillDao;
	}

	public void setBusinessBillDao(BusinessBillDao businessBillDao) {
		this.businessBillDao = businessBillDao;
	}

	public String getOnlineLoginBridgeView() {
		return this.onlineLoginBridgeView;
	}

	public void setOnlineLoginBridgeView(String onlineLoginBridgeView) {
		this.onlineLoginBridgeView = onlineLoginBridgeView;
	}

	public String getOnlineMainView() {
		return this.onlineMainView;
	}

	public void setOnlineMainView(String onlineMainView) {
		this.onlineMainView = onlineMainView;
	}

	public String getOnlineDesktopView() {
		return this.onlineDesktopView;
	}

	public void setOnlineDesktopView(String onlineDesktopView) {
		this.onlineDesktopView = onlineDesktopView;
	}

	public String getImpoSuccessView() {
		return this.impoSuccessView;
	}

	public void setImpoSuccessView(String impoSuccessView) {
		this.impoSuccessView = impoSuccessView;
	}

	public String getAppBarcodeView() {
		return this.appBarcodeView;
	}

	public void setAppBarcodeView(String appBarcodeView) {
		this.appBarcodeView = appBarcodeView;
	}

	public String getDesktopMsgView() {
		return this.desktopMsgView;
	}

	public void setDesktopMsgView(String desktopMsgView) {
		this.desktopMsgView = desktopMsgView;
	}

	public String getDesktopFlowView() {
		return this.desktopFlowView;
	}

	public void setDesktopFlowView(String desktopFlowView) {
		this.desktopFlowView = desktopFlowView;
	}

	public TallySetDao getTallySetDao() {
		return this.tallySetDao;
	}

	public void setTallySetDao(TallySetDao tallySetDao) {
		this.tallySetDao = tallySetDao;
	}

	public String getReportMainView() {
		return this.reportMainView;
	}

	public void setReportMainView(String reportMainView) {
		this.reportMainView = reportMainView;
	}

	public String getCancelReasonView() {
		return this.cancelReasonView;
	}

	public void setCancelReasonView(String cancelReasonView) {
		this.cancelReasonView = cancelReasonView;
	}

	public String getAboutEkingView() {
		return this.aboutEkingView;
	}

	public void setAboutEkingView(String aboutEkingView) {
		this.aboutEkingView = aboutEkingView;
	}

	public String getCancelLogListView() {
		return this.cancelLogListView;
	}

	public void setCancelLogListView(String cancelLogListView) {
		this.cancelLogListView = cancelLogListView;
	}

	public ModelAndView handleRandomImageCode(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		EncCommonHelper.createRandomImageCode(request, response);
		return null;
	}

	public ModelAndView handleMain(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		LicenseInfo li = EncCommonHelper.getLicenseInfo(request);
		Date now = new Date();
		SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
		String showClieUser = "N";
		String endDiff = "";
		if (li.getOnlineEnd() != null && !li.getOnlineEnd().equals("")) {
			Date onlineEnd = sf.parse(li.getOnlineEnd());
			if (now.before(onlineEnd)) {
				showClieUser = "Y";
				Calendar c = Calendar.getInstance();
				c.setTime(now);
				long nowMill = c.getTimeInMillis();
				c.setTime(onlineEnd);
				long endMill = c.getTimeInMillis();
				int dayDiff = (int) ((endMill - nowMill) / 86400000L);
				++dayDiff;
				if (dayDiff <= 7) {
					endDiff = "" + dayDiff;
				}
			}
		}

		return (new ModelAndView(this.mainView)).addObject("endDiff", endDiff)
				.addObject("showClieUser", showClieUser)
				.addObject("currentTime", now);
	}

	public ModelAndView handleTopMenu(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return (new ModelAndView(this.topMenuView)).addObject("currentTime",
				new Date());
	}

	public ModelAndView handleLeftMenu(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return new ModelAndView(this.leftMenuView);
	}

	public ModelAndView handleFoot(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return (new ModelAndView(this.footView)).addObject("currentTime",
				new Date());
	}

	public ModelAndView handleDesktop(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		EnterpriseInfo ent = EncCommonHelper.getEnterpriseInfo(request);
		String type = request.getParameter("type");
		if (type == null || type.equals("")) {
			type = ent.getDeskType();
		}

		UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
		ModelAndView mv;
		if (type.equals("MSG")
				&& (ub.getUser().getUserType() == 1 || !EncCommonHelper
						.checkPurePrivilege(request, "NO_COMM"))) {
			mv = new ModelAndView(this.desktopMsgView);
			Calendar c = Calendar.getInstance();
			Date now = new Date();
			c.setTime(now);
			c.add(5, -7);
			List columnList = this.bbsColumnDao.getList();
			List articleList = this.bbsArticleDao.getTopList(c.getTime());
			ArrayList arr = new ArrayList();

			for (int i = 0; i < articleList.size(); ++i) {
				BbsArticleBean bean = new BbsArticleBean();
				BbsArticle a = (BbsArticle) articleList.get(i);
				bean.setBbsArticle(a);

				for (int j = 0; j < columnList.size(); ++j) {
					BbsColumn bc = (BbsColumn) columnList.get(j);
					if (bc.getId() == a.getColumnId()) {
						bean.setColumnName(bc.getColumnName());
						break;
					}
				}

				arr.add(bean);
			}

			mv.addObject("bbsArticleList", arr);
			if (ub.getStaffer() != null) {
				mv.addObject("messageList", this.messageDao.getTopInList(ub
						.getStaffer().getId(), 3));
				mv.addObject("willDoList", this.establishmentCommunicateDao
						.getWillDoList(ub.getStaffer().getId()));
			}
		} else {
			mv = new ModelAndView(this.desktopFlowView);
		}

		return mv;
	}

	public ModelAndView handleLoginBridge(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String forwardAction = request.getParameter("signonForwardUrl");
		return (new ModelAndView(this.loginBridgeView)).addObject(
				"signonForwardUrl", forwardAction);
	}

	public ModelAndView handleLogout(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		PageHelper.doUserLogout(this.messageDao, this.idGenerator, request, "");
		return new ModelAndView(this.logoutView);
	}

	public ModelAndView handleModalDialog(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String url = request.getParameter("targetUrl");
		return (new ModelAndView(this.modalDialogView)).addObject("targetUrl",
				url);
	}

	public ModelAndView handleModalDialogSuccess(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String returnValue = request.getParameter("returnValue");
		String alertType = request.getParameter("alertType");
		ModelAndView mv = new ModelAndView(this.modalDialogSuccessView);
		mv.addObject("returnValue", returnValue);
		mv.addObject("alertType", alertType);
		mv.addObject("openWin", request.getParameter("openWin"));
		mv.addObject("openWinWidth", request.getParameter("openWinWidth"));
		mv.addObject("openWinHeight", request.getParameter("openWinHeight"));
		return mv;
	}

	public ModelAndView handleCalendarSelect(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.calendarSelectView);
		mv.addObject("currentDate", new Date());
		mv.addObject("title", request.getParameter("title"));
		mv.addObject("label", request.getParameter("label"));
		return mv;
	}

	public ModelAndView handleSpellSelect(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		Date now = new Date();
		SimpleDateFormat monthSf = new SimpleDateFormat("yyyy-MM");
		SimpleDateFormat dateSf = new SimpleDateFormat("yyyy-MM-dd");
		String startDate = monthSf.format(now) + "-01";
		String endDate = dateSf.format(now);
		String title = request.getParameter("title");
		return (new ModelAndView(this.spellSelectView))
				.addObject("start_date", startDate)
				.addObject("end_date", endDate).addObject("title", title);
	}

	public ModelAndView handleSystemMain(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return new ModelAndView(this.systemMainView);
	}

	public ModelAndView handleBaseMain(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return new ModelAndView(this.baseMainView);
	}

	public ModelAndView handleFinanceMain(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return new ModelAndView(this.financeMainView);
	}

	public ModelAndView handleMakeMain(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return new ModelAndView(this.makeMainView);
	}

	public ModelAndView handleBusinessMain(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return new ModelAndView(this.businessMainView);
	}

	public ModelAndView handleStorehouseMain(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return new ModelAndView(this.storehouseMainView);
	}

	public ModelAndView handlePurchaseMain(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return new ModelAndView(this.purchaseMainView);
	}

	public ModelAndView handleSmsMain(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return new ModelAndView(this.smsMainView);
	}

	public ModelAndView handleCooperMain(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return new ModelAndView(this.cooperMainView);
	}

	public ModelAndView handleOnlineList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.onlineListView);
		mv.addObject("onlineList", OnlineListener.getOnlines());
		mv.addObject("appList", OnlineListener.getAppOnlines());
		mv.addObject("debugStr", OnlineListener.getDebugString());
		return mv;
	}

	public ModelAndView handleOnlineOut(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
		if (ub != null && ub.getUser().getUserType() == 1) {
			String id = request.getParameter("id");
			String type = request.getParameter("type");
			if (type != null && type.equals("APP")) {
				EncInterceptorHelper.removeAppUser(Long.parseLong(id));
			} else {
				EncInterceptorHelper.removeUser(Long.parseLong(id));
			}
		}

		return new ModelAndView("redirect:/system/OnlineList.ihtm");
	}

	public ModelAndView handleFileDownloadLog(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
		String id = request.getParameter("id");
		String msg = "";
		if (ub != null) {
			DownloadLog out = new DownloadLog();
			out.setAcceId(Long.parseLong(id));
			out.setCreaterId(ub.getStaffer().getId());
			out.setCreaterName(ub.getStaffer().getStafferName());
			out.setId(this.idGenerator.getId(DownloadLog.class.getName()));
			this.messageDao.save(out);
			msg = "OK";
		} else {
			msg = "NO_LOGIN";
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ServletOutputStream out1 = response.getOutputStream();
		out1.write(msg.getBytes());
		out1.flush();
		out1.close();
		return null;
	}

	public ModelAndView handleFileDownload(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String fileName = request.getParameter("file_name");
		String sourceName = request.getParameter("source_name");
		String path = this.getServletContext().getRealPath("/");
		if (!path.endsWith(File.separator)) {
			path = path + File.separator;
		}

		File file = new File(path + fileName);
		FileInputStream is = null;
		ServletOutputStream out = null;
		if (file.exists() && file.isFile()) {
			try {
				if (sourceName == null || sourceName.equals("")) {
					sourceName = file.getName();
				}

				sourceName = URLEncoder.encode(sourceName, "utf-8");
				response.setCharacterEncoding("utf-8");
				response.setContentType("APPLICATION/OCTET-STREAM");
				response.setHeader("Content-Disposition",
						"attachment; filename=\"" + sourceName + "\"");
				is = new FileInputStream(file);
				out = response.getOutputStream();

				int errMsg1;
				while ((errMsg1 = is.read()) != -1) {
					out.write(errMsg1);
				}

				out.flush();
			} finally {
				if (is != null) {
					is.close();
				}

				if (out != null) {
					out.close();
				}

			}
		} else {
			String errMsg = "File not exist!";

			try {
				response.setCharacterEncoding("utf-8");
				response.setContentType("text/plain");
				out = response.getOutputStream();
				out.write(errMsg.getBytes());
				out.flush();
			} finally {
				if (out != null) {
					out.close();
				}

			}
		}

		return null;
	}

	public ModelAndView handleSystemLogList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "SYST_LOG")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.systemLogListView);
			String hisObjName = "com.minierp.model.SystemLog";
			String hisObjShortName = "h";
			HashMap shortNameMap = new HashMap();
			String[] retObjs = new String[]{hisObjShortName};
			Vector qpVe = new Vector();
			HashMap parameters = new HashMap();
			shortNameMap.put(hisObjName, hisObjShortName);
			new QueryParameterCarrier();
			String searchType = request.getParameter("search_type");
			String type = request.getParameter("type");
			String startDate = request.getParameter("start_date");
			String endDate = request.getParameter("end_date");
			String status = request.getParameter("status");
			String stafferId = request.getParameter("staffer_id");
			String stafferName = request.getParameter("staffer_name");
			String depId = request.getParameter("dep_id");
			QueryParameterCarrier qp = new QueryParameterCarrier();
			qp.objectName = hisObjName;
			qp.propertyName = "logType";
			qp.value = " h.logType=\'USER_LOG\'";
			qp.dataType = 6;
			qp.logicType = 10;
			qpVe.add(qp);
			if (searchType != null && !searchType.equals("")) {
				if (searchType.equals("2")) {
					qp = new QueryParameterCarrier();
					qp.objectName = hisObjName;
					qp.propertyName = "createTime";
					qp.value = startDate;
					qp.dataType = 4;
					qp.logicType = 5;
					qpVe.add(qp);
					qp = new QueryParameterCarrier();
					qp.objectName = hisObjName;
					qp.propertyName = "createTime";
					qp.value = EncCommonHelper.getNextDateStr(endDate,
							"yyyy-MM-dd");
					qp.dataType = 4;
					qp.logicType = 4;
					qpVe.add(qp);
				} else {
					String arg25 = request.getParameter("cb_cre_date");
					String arg27 = request.getParameter("cb_status");
					String oParas = request.getParameter("cb_type");
					String qr = request.getParameter("cb_sta");
					String cbDep = request.getParameter("cb_dep");
					if (arg25 != null && arg25.equals("1")) {
						qp = new QueryParameterCarrier();
						qp.objectName = hisObjName;
						qp.propertyName = "createTime";
						qp.value = startDate;
						qp.dataType = 4;
						qp.logicType = 5;
						qpVe.add(qp);
						qp = new QueryParameterCarrier();
						qp.objectName = hisObjName;
						qp.propertyName = "createTime";
						qp.value = EncCommonHelper.getNextDateStr(endDate,
								"yyyy-MM-dd");
						qp.dataType = 4;
						qp.logicType = 4;
						qpVe.add(qp);
						parameters.put("cbCreDate", arg25);
					}

					if (arg27 != null && arg27.equals("1")) {
						if (!status.equalsIgnoreCase("A")) {
							qp = new QueryParameterCarrier();
							qp.objectName = hisObjName;
							qp.propertyName = "status";
							qp.value = status;
							qp.dataType = 1;
							qp.logicType = 1;
							qpVe.add(qp);
						}

						parameters.put("cbStatus", arg27);
					}

					if (oParas != null && oParas.equals("1")) {
						if (!type.equalsIgnoreCase("A")) {
							qp = new QueryParameterCarrier();
							qp.objectName = hisObjName;
							qp.propertyName = "actionCode";
							qp.value = type;
							qp.dataType = 1;
							qp.logicType = 1;
							qpVe.add(qp);
						}

						parameters.put("cbType", oParas);
					}

					if (qr != null && qr.equals("1")) {
						qp = new QueryParameterCarrier();
						qp.objectName = hisObjName;
						qp.propertyName = "createrId";
						qp.value = stafferId;
						qp.dataType = 3;
						qp.logicType = 1;
						qpVe.add(qp);
						parameters.put("cbSta", qr);
					}

					if (cbDep != null && cbDep.equals("1")) {
						String depObjName = "com.minierp.model.Department";
						String depObjShortName = "d";
						shortNameMap.put(depObjName, depObjShortName);
						qp = new QueryParameterCarrier();
						qp.objectName = hisObjName;
						qp.propertyName = "depId";
						qp.value = " h.depId=d.id";
						qp.dataType = 6;
						qp.logicType = 10;
						qpVe.add(qp);
						qp = new QueryParameterCarrier();
						qp.objectName = depObjName;
						qp.propertyName = "id";
						qp.value = " (d.id=" + depId
								+ " or (d.parentIdStr like \';" + depId
								+ ";\'))";
						qp.dataType = 6;
						qp.logicType = 10;
						qpVe.add(qp);
						parameters.put("cbDep", cbDep);
					}
				}
			} else {
				searchType = "2";
				Date qParas = new Date();
				SimpleDateFormat p1 = new SimpleDateFormat("yyyy-MM");
				startDate = p1.format(qParas) + "-01";
				p1 = new SimpleDateFormat("yyyy-MM-dd");
				endDate = p1.format(qParas);
				qp = new QueryParameterCarrier();
				qp.objectName = hisObjName;
				qp.propertyName = "createTime";
				qp.value = startDate;
				qp.dataType = 4;
				qp.logicType = 5;
				qpVe.add(qp);
				qp = new QueryParameterCarrier();
				qp.objectName = hisObjName;
				qp.propertyName = "createTime";
				qp.value = EncCommonHelper
						.getNextDateStr(endDate, "yyyy-MM-dd");
				qp.dataType = 4;
				qp.logicType = 4;
				qpVe.add(qp);
			}

			parameters.put("searchType", searchType);
			parameters.put("type", type);
			parameters.put("startDate", startDate);
			parameters.put("endDate", endDate);
			parameters.put("status", status);
			parameters.put("stafferId", stafferId);
			parameters.put("stafferName", stafferName);
			parameters.put("depId", depId);
			QueryParameterCarrier[] arg26 = new QueryParameterCarrier[qpVe
					.size()];

			for (int arg28 = 0; arg28 < qpVe.size(); ++arg28) {
				arg26[arg28] = (QueryParameterCarrier) qpVe.get(arg28);
			}

			OrderParameterCarrier arg30 = new OrderParameterCarrier();
			arg30.objectName = hisObjName;
			arg30.propertyName = "id";
			arg30.orderTarget = "desc";
			OrderParameterCarrier[] arg29 = new OrderParameterCarrier[]{arg30};
			QueryResult arg31 = this.queryDao.doQuery(
					EncCommonHelper.getCurrentPageIndex(request),
					EncCommonHelper.getPageSize(request), arg26, arg29,
					(String[]) null, shortNameMap, retObjs, (String[]) null);
			mv.addObject("qr", arg31);
			mv.addAllObjects(parameters);
			mv.addObject("departmentList", this.departmentDao.getList(true));
			return mv;
		}
	}

	public ModelAndView handleCancelLogList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		if (!EncCommonHelper.checkPrivilege(request, "CANC_LOG")) {
			throw new PermissionDennyException("Permission Denny");
		} else {
			ModelAndView mv = new ModelAndView(this.cancelLogListView);
			String hisObjName = "com.minierp.model.SystemLog";
			String hisObjShortName = "h";
			HashMap shortNameMap = new HashMap();
			String[] retObjs = new String[]{hisObjShortName};
			Vector qpVe = new Vector();
			HashMap parameters = new HashMap();
			shortNameMap.put(hisObjName, hisObjShortName);
			new QueryParameterCarrier();
			String searchType = request.getParameter("search_type");
			String type = request.getParameter("type");
			String startDate = request.getParameter("start_date");
			String endDate = request.getParameter("end_date");
			String stafferId = request.getParameter("staffer_id");
			String stafferName = request.getParameter("staffer_name");
			String depId = request.getParameter("dep_id");
			String billCode = request.getParameter("bill_code");
			String mark = request.getParameter("mark");
			String tsId = request.getParameter("ts_id");
			QueryParameterCarrier qp = new QueryParameterCarrier();
			qp.objectName = hisObjName;
			qp.propertyName = "logType";
			qp.value = " h.logType=\'CANCEL_LOG\'";
			qp.dataType = 6;
			qp.logicType = 10;
			qpVe.add(qp);
			UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
			String oParas;
			if (searchType != null && !searchType.equals("")) {
				String arg29;
				if (searchType.equals("2")) {
					qp = new QueryParameterCarrier();
					qp.objectName = hisObjName;
					qp.propertyName = "createTime";
					qp.value = startDate;
					qp.dataType = 4;
					qp.logicType = 5;
					qpVe.add(qp);
					qp = new QueryParameterCarrier();
					qp.objectName = hisObjName;
					qp.propertyName = "createTime";
					qp.value = EncCommonHelper.getNextDateStr(endDate,
							"yyyy-MM-dd");
					qp.dataType = 4;
					qp.logicType = 4;
					qpVe.add(qp);
					arg29 = EncCommonHelper.createTallySetSQLStr(
							"h.tallySetId", ub, false);
					if (arg29 != null && !arg29.equals("")) {
						qpVe.add(new QueryParameterCarrier(hisObjName,
								"tallySetId", arg29, 6, 10));
					}
				} else {
					arg29 = request.getParameter("cb_cre_date");
					String arg31 = request.getParameter("cb_type");
					oParas = request.getParameter("cb_sta");
					String qr = request.getParameter("cb_dep");
					String cbBillCode = request.getParameter("cb_bill_code");
					String cbMark = request.getParameter("cb_mark");
					String cbTs = request.getParameter("cb_ts");
					if (cbTs != null && cbTs.equals("1")) {
						qpVe.add(new QueryParameterCarrier(hisObjName,
								"tallySetId", " h.tallySetId=" + tsId, 6, 10));
						parameters.put("cbTs", cbTs);
					} else {
						String tsHQL = EncCommonHelper.createTallySetSQLStr(
								"h.tallySetId", ub, false);
						if (tsHQL != null && !tsHQL.equals("")) {
							qpVe.add(new QueryParameterCarrier(hisObjName,
									"tallySetId", tsHQL, 6, 10));
						}
					}

					if (arg29 != null && arg29.equals("1")) {
						qp = new QueryParameterCarrier();
						qp.objectName = hisObjName;
						qp.propertyName = "createTime";
						qp.value = startDate;
						qp.dataType = 4;
						qp.logicType = 5;
						qpVe.add(qp);
						qp = new QueryParameterCarrier();
						qp.objectName = hisObjName;
						qp.propertyName = "createTime";
						qp.value = EncCommonHelper.getNextDateStr(endDate,
								"yyyy-MM-dd");
						qp.dataType = 4;
						qp.logicType = 4;
						qpVe.add(qp);
						parameters.put("cbCreDate", arg29);
					}

					if (oParas != null && oParas.equals("1")) {
						qp = new QueryParameterCarrier();
						qp.objectName = hisObjName;
						qp.propertyName = "createrId";
						qp.value = stafferId;
						qp.dataType = 3;
						qp.logicType = 1;
						qpVe.add(qp);
						parameters.put("cbSta", oParas);
					}

					if (qr != null && qr.equals("1")) {
						qp = new QueryParameterCarrier();
						qp.objectName = hisObjName;
						qp.propertyName = "depId";
						qp.value = depId;
						qp.dataType = 3;
						qp.logicType = 1;
						qpVe.add(qp);
						parameters.put("cbDep", qr);
					}

					if (cbBillCode != null && cbBillCode.equals("1")) {
						qp = new QueryParameterCarrier();
						qp.objectName = hisObjName;
						qp.propertyName = "ip";
						qp.value = billCode;
						qp.dataType = 1;
						qp.logicType = 9;
						qpVe.add(qp);
						parameters.put("cbBillCode", cbBillCode);
					}

					if (cbMark != null && cbMark.equals("1")) {
						qp = new QueryParameterCarrier();
						qp.objectName = hisObjName;
						qp.propertyName = "cancelReason";
						qp.value = mark;
						qp.dataType = 1;
						qp.logicType = 9;
						qpVe.add(qp);
						parameters.put("cbMark", cbMark);
					}

					if (arg31 != null && arg31.equals("1")) {
						qp = new QueryParameterCarrier();
						qp.objectName = hisObjName;
						qp.propertyName = "actionCode";
						qp.value = type;
						qp.dataType = 1;
						qp.logicType = 1;
						qpVe.add(qp);
						parameters.put("cbType", arg31);
					}
				}
			} else {
				searchType = "2";
				Date qParas = new Date();
				SimpleDateFormat p1 = new SimpleDateFormat("yyyy-MM");
				startDate = p1.format(qParas) + "-01";
				p1 = new SimpleDateFormat("yyyy-MM-dd");
				endDate = p1.format(qParas);
				qp = new QueryParameterCarrier();
				qp.objectName = hisObjName;
				qp.propertyName = "createTime";
				qp.value = startDate;
				qp.dataType = 4;
				qp.logicType = 5;
				qpVe.add(qp);
				qp = new QueryParameterCarrier();
				qp.objectName = hisObjName;
				qp.propertyName = "createTime";
				qp.value = EncCommonHelper
						.getNextDateStr(endDate, "yyyy-MM-dd");
				qp.dataType = 4;
				qp.logicType = 4;
				qpVe.add(qp);
				oParas = EncCommonHelper.createTallySetSQLStr("h.tallySetId",
						ub, false);
				if (oParas != null && !oParas.equals("")) {
					qpVe.add(new QueryParameterCarrier(hisObjName,
							"tallySetId", oParas, 6, 10));
				}
			}

			parameters.put("searchType", searchType);
			parameters.put("type", type);
			parameters.put("mark", mark);
			parameters.put("billCode", billCode);
			parameters.put("startDate", startDate);
			parameters.put("endDate", endDate);
			parameters.put("stafferId", stafferId);
			parameters.put("stafferName", stafferName);
			parameters.put("depId", depId);
			parameters.put("tsId", tsId);
			QueryParameterCarrier[] arg30 = new QueryParameterCarrier[qpVe
					.size()];

			for (int arg32 = 0; arg32 < qpVe.size(); ++arg32) {
				arg30[arg32] = (QueryParameterCarrier) qpVe.get(arg32);
			}

			OrderParameterCarrier arg33 = new OrderParameterCarrier();
			arg33.objectName = hisObjName;
			arg33.propertyName = "id";
			arg33.orderTarget = "desc";
			OrderParameterCarrier[] arg34 = new OrderParameterCarrier[]{arg33};
			QueryResult arg35 = this.queryDao.doQuery(
					EncCommonHelper.getCurrentPageIndex(request),
					EncCommonHelper.getPageSize(request), arg30, arg34,
					(String[]) null, shortNameMap, retObjs, (String[]) null);
			mv.addObject("qr", arg35);
			mv.addAllObjects(parameters);
			mv.addObject("departmentList", this.departmentDao.getList(true));
			mv.addObject("tsList",
					PageHelper.getTallySetList(this.tallySetDao, ub));
			return mv;
		}
	}

	public ModelAndView handleAboutEking(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.aboutEkingView);
		String urlStr = request.getRequestURL().toString();
		urlStr = urlStr.substring(0, urlStr.lastIndexOf("/"));
		mv.addObject("urlStr", urlStr);
		return mv;
	}

	public ModelAndView handleCancelReason(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.cancelReasonView);
		String id = request.getParameter("id");
		String type = request.getParameter("cancel_type");
		mv.addObject("id", id);
		mv.addObject("cancel_type", type);
		return mv;
	}

	public ModelAndView handleLeftMessage(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
		Document doc = DocumentHelper.createDocument();
		OutputFormat format = OutputFormat.createPrettyPrint();
		format.setEncoding("utf-8");
		if (ub != null) {
			List out = this.messageDao.getTopInList(ub.getStaffer().getId(), 5);
			Element output = doc.addElement("body");

			for (int i = 0; i < out.size(); ++i) {
				Object[] objs = (Object[]) out.get(i);
				Message m = (Message) objs[0];
				Element msg = output.addElement("msg");
				Element id = msg.addElement("id");
				id.setText(String.valueOf(m.getId()));
				Element sender = msg.addElement("sender");
				sender.setText(m.getSenderName());
				Element title = msg.addElement("title");
				title.setText(m.getTitle());
			}
		}

		response.setContentType("text/xml");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ServletOutputStream arg14 = response.getOutputStream();
		XMLWriter arg15 = new XMLWriter(arg14, format);
		arg15.write(doc);
		arg14.flush();
		arg14.close();
		return null;
	}

	public ModelAndView handleMessageReadFlagUpdate(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
		if (ub == null) {
			return null;
		} else {
			String id = request.getParameter("id");
			if (id != null && !id.equals("")) {
				String[] idArr = id.split(";");

				for (int mv = 0; mv < idArr.length; ++mv) {
					this.messageDao.updateReadFlag(Long.parseLong(idArr[mv]),
							ub.getStaffer().getId());
				}

				ModelAndView arg6 = new ModelAndView(
						"redirect:/ModalDialogSuccess.ihtm");
				EncCommonHelper.setAlertMessage(request, "保存成功");
				arg6.addObject("returnValue", "1");
				return arg6;
			} else {
				this.messageDao.updateReadFlag(ub.getStaffer().getId());
				return null;
			}
		}
	}

	public ModelAndView handleReportMain(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return new ModelAndView(this.reportMainView);
	}

	public ModelAndView handleGetAppInfo(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		HashMap map = new HashMap();
		map.put("appVerCode", EncCommonHelper.getProperty("appVerCode"));
		map.put("sysName", EncCommonHelper.getProperty("sysName"));
		map.put("sysCode", EncCommonHelper.getProperty("sysCode"));
		map.put("updateEnd", EncCommonHelper.getProperty("updateEnd"));
		map.put("version", EncCommonHelper.getProperty("version"));
		String willEnd = "N";
		String updateEnd = EncCommonHelper.getProperty("updateEnd");
		if (updateEnd != null && !updateEnd.equals("")) {
			SimpleDateFormat mapper = new SimpleDateFormat("yyyy-MM-dd");
			Date json = mapper.parse(updateEnd);
			Date out = new Date();
			if (json.after(out)) {
				Calendar c = Calendar.getInstance();
				c.setTime(new Date());
				c.add(5, 14);
				if (json.before(c.getTime())) {
					willEnd = "Y";
				}
			}
		}

		map.put("willEnd", willEnd);
		ObjectMapper mapper1 = new ObjectMapper();
		String json1 = mapper1.writeValueAsString(map);
		ServletOutputStream out1 = response.getOutputStream();
		out1.write(json1.getBytes("utf-8"));
		out1.flush();
		out1.close();
		return null;
	}

	public ModelAndView handleAppBarcode(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ModelAndView mv = new ModelAndView(this.appBarcodeView);
		String path = this.getServletContext().getRealPath("/");
		String codeFileName = "/upload/barcode.jpg";
		EnterpriseInfo ent = this.enterpriseInfoDao.get();
		String scFileName = ent.getImage();
		String urlStr = request.getParameter("url_str");
		if (urlStr != null && !urlStr.equals("")) {
			if (!urlStr.toLowerCase().startsWith("http://")) {
				urlStr = "http://" + urlStr;
			}

			if (!urlStr.endsWith("/")) {
				urlStr = urlStr + "/";
			}

			String file = urlStr + "app/EkingEnt.apk";
			BarcodeHelper.encode(file, 512, 512, path + scFileName, path
					+ codeFileName);
		} else {
			urlStr = request.getRequestURL().toString();
			urlStr = urlStr.substring(0, urlStr.lastIndexOf("/app/"));
		}

		mv.addObject("urlStr", urlStr);
		File file1 = new File(path + codeFileName);
		if (file1.exists()) {
			mv.addObject("barcode", codeFileName);
		}

		return mv;
	}

	public ModelAndView handleAppLogout(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		PageHelper.doUserLogout(this.messageDao, this.idGenerator, request,
				"APP");
		return null;
	}

	public ModelAndView handleAppLogoutByApp(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		PageHelper.doUserLogout(this.messageDao, this.idGenerator, request,
				"APP");
		return null;
	}

	public ModelAndView handleAppCancList(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		HashMap map = new HashMap();
		UserStatus s = EncInterceptorHelper.checkAppUserSignon(request);
		UserBean ub = s.getUserBean();
		String json;
		if (ub == null) {
			map.put("status", "NO_LOGIN");
			map.put("errMsg", "");
		} else if (!EncCommonHelper.checkPrivilege(request, "CANC_LOG")) {
			map.put("status", "ERROR");
			map.put("errMsg", "您还没有此功能的使用权限，请确认返回！");
		} else {
			try {
				String mapper = request.getParameter("code");
				json = request.getParameter("start_date");
				String out = request.getParameter("end_date");
				String bt = request.getParameter("bt");
				String creaName = request.getParameter("crea_name");
				String tsIdStr = request.getParameter("ts_id");
				String showPrev = request.getParameter("show_prev");
				String initQuer = request.getParameter("init_quer");
				long tsId = 0L;
				if (tsIdStr != null && !tsIdStr.equals("")) {
					tsId = Long.parseLong(tsIdStr);
				}

				SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
				SimpleDateFormat sfl = new SimpleDateFormat("yyyy-MM-dd HH:mm");
				Date startDate = null;
				Date endDate = null;
				if (json != null && !json.equals("")) {
					startDate = sf.parse(json);
				}

				if (out != null && !out.equals("")) {
					endDate = sf.parse(EncCommonHelper.getNextDateStr(out,
							"yyyy-MM-dd"));
				}

				int total = this.systemLogDao.getAppCancListCount(startDate,
						endDate, bt, mapper, creaName, tsId, ub);
				int perPageNum = EncCommonHelper.getPageSize(request);
				int pageno = EncCommonHelper.getCurrentPageIndex(request,
						total, perPageNum);
				if (total > pageno * perPageNum) {
					map.put("more", "Y");
				} else {
					map.put("more", "N");
				}

				map.put("total", Integer.valueOf(total));
				List list;
				if (showPrev != null && showPrev.equals("Y")) {
					list = this.systemLogDao.getAppCancList(startDate, endDate,
							bt, mapper, creaName, tsId, ub, 0, pageno
									* perPageNum);
				} else {
					list = this.systemLogDao.getAppCancList(startDate, endDate,
							bt, mapper, creaName, tsId, ub, (pageno - 1)
									* perPageNum, perPageNum);
				}

				ArrayList items = new ArrayList();

				for (int tmpList = 0; tmpList < list.size(); ++tmpList) {
					HashMap tsItems = new HashMap();
					SystemLog i = (SystemLog) list.get(tmpList);
					tsItems.put("billId", Long.valueOf(i.getRelId()));
					tsItems.put("code", i.getIp());
					tsItems.put("bt", i.getActionCode());
					tsItems.put("reason",
							PageHelper.parseNull(i.getCancelReason()));
					tsItems.put("creaName", i.getCreaterName());
					tsItems.put("creaTime", sfl.format(i.getCreateTime()));
					items.add(tsItems);
				}

				map.put("items", items);
				if (initQuer != null && initQuer.equals("Y")) {
					List arg30 = PageHelper.getTallySetList(this.tallySetDao,
							ub);
					ArrayList arg31 = new ArrayList();

					for (int arg32 = 0; arg32 < arg30.size(); ++arg32) {
						HashMap item = new HashMap();
						TallySet ts = (TallySet) arg30.get(arg32);
						item.put("id", Long.valueOf(ts.getId()));
						item.put("name", ts.getTitle());
						arg31.add(item);
					}

					map.put("tsItems", arg31);
				}

				map.put("status", "OK");
				map.put("errMsg", "");
			} catch (Exception arg29) {
				map.put("status", "ERROR");
				map.put("errMsg", arg29.toString());
			}
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ObjectMapper arg33 = new ObjectMapper();
		json = arg33.writeValueAsString(map);
		ServletOutputStream arg34 = response.getOutputStream();
		arg34.write(json.getBytes("utf-8"));
		arg34.flush();
		arg34.close();
		return null;
	}

	public ModelAndView handleAppGetMenu(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		HashMap map = new HashMap();
		UserStatus s = EncInterceptorHelper.checkAppUserSignon(request);
		UserBean ub = s.getUserBean();
		if (ub == null) {
			map.put("status", "NO_LOGIN");
			map.put("errMsg", "");
		} else {
			HashMap mapper = new HashMap();
			mapper.put("SEAR_MENU_1", new String[]{"BUSI_BILL_SEAR",
					"RECE_BILL_SEAR"});
			mapper.put("SEAR_MENU_2", new String[]{"FEE_BILL_SEAR",
					"PAY_BILL_SEAR"});
			mapper.put("SEAR_MENU_3", new String[]{"COOP_BILL_SEAR",
					"PURC_BUY_SEAR"});
			mapper.put("FIND_MENU_1", new String[]{"BUSI_BILL_SEAR",
					"DELI_NEW", "RECE_NEW", "DELI_CONF", "SETU_COMP"});
			mapper.put("REPO_MENU_1", new String[]{"BUSI_DATE_COUN",
					"MT_BUSI_DATE", "CLIE_BUSI_COUN", "CLIE_BACK_COUN"});
			mapper.put("REPO_MENU_2", new String[]{"CLIE_UN_RECE",
					"UN_PAY_SEAR"});
			mapper.put("REPO_MENU_3", new String[]{"BANK_COST",
					"BUSI_BACK_SEAR", "PURC_PAY_SEAR", "COOP_PAY_SEAR"});
			mapper.put("EXAM_MENU_1", new String[]{"BUSI_EXAM", "RECE_EXAM",
					"ADJU_EXAM"});
			mapper.put("EXAM_MENU_2", new String[]{"FEE_EXAM", "PAY_EXAM",
					"COOP_EXAM", "PURC_BUY_EXAM", "PURC_BACK_EXAM"});
			mapper.put("UNEX_MENU_1", new String[]{"BUSI_UN_EXAM",
					"RECE_UN_EXAM", "ADJU_UN_EXAM"});
			mapper.put("UNEX_MENU_2", new String[]{"FEE_UN_EXAM",
					"PAY_UN_EXAM", "COOP_UN_EXAM", "PURC_BUY_UN_EXAM",
					"PURC_BACK_UN_EXAM"});
			mapper.put("APPL_MENU_4", new String[]{"CANC_LOG", "BUSI_LOG"});
			Object[] json = mapper.keySet().toArray();

			for (int out = 0; out < json.length; ++out) {
				String key = (String) json[out];
				String[] codes = (String[]) mapper.get(key);
				boolean found = false;

				for (int j = 0; j < codes.length; ++j) {
					String code = codes[j];
					if (EncCommonHelper.checkPrivilege(request, code)) {
						map.put(code, "Y");
						found = true;
					} else {
						map.put(code, "N");
					}
				}

				if (found) {
					map.put(key, "Y");
				} else {
					map.put(key, "N");
				}
			}

			if (!map.get("REPO_MENU_1").toString().equals("Y")
					&& !map.get("REPO_MENU_2").toString().equals("Y")
					&& !map.get("REPO_MENU_3").toString().equals("Y")) {
				map.put("REPO_MENU", "N");
				map.put("APPL_MENU_1", "N");
			} else {
				map.put("REPO_MENU", "Y");
				map.put("APPL_MENU_1", "Y");
			}

			if (!map.get("EXAM_MENU_1").toString().equals("Y")
					&& !map.get("EXAM_MENU_2").toString().equals("Y")) {
				map.put("EXAM_MENU", "N");
			} else {
				map.put("EXAM_MENU", "Y");
			}

			if (!map.get("UNEX_MENU_1").toString().equals("Y")
					&& !map.get("UNEX_MENU_2").toString().equals("Y")) {
				map.put("UNEX_MENU", "N");
			} else {
				map.put("UNEX_MENU", "Y");
			}

			if (!map.get("EXAM_MENU").toString().equals("Y")
					&& !map.get("UNEX_MENU").toString().equals("Y")) {
				map.put("APPL_MENU_2", "N");
			} else {
				map.put("APPL_MENU_2", "Y");
			}

			map.put("status", "OK");
			map.put("errMsg", "");
		}

		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		ObjectMapper arg13 = new ObjectMapper();
		String arg14 = arg13.writeValueAsString(map);
		ServletOutputStream arg15 = response.getOutputStream();
		arg15.write(arg14.getBytes("utf-8"));
		arg15.flush();
		arg15.close();
		return null;
	}

	public ModelAndView handleFileUpload(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		UserBean ub = EncCommonHelper.getCurrentUserAccount(request);
		MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
		MultipartFile multipartFile = multipartRequest
				.getFile("accessory_file");
		String uploadPath;
		String realPath;
		if (multipartFile != null && !multipartFile.isEmpty()) {
			uploadPath = EncCommonHelper.getUploadVirtualPath(this
					.getServletContext());
			realPath = this.getServletContext().getRealPath(uploadPath);
			String fileName = ub.getUser().getId()
					+ "_"
					+ System.currentTimeMillis()
					+ "."
					+ EncCommonHelper.getExtendName(multipartFile
							.getOriginalFilename());
			InputStream in = null;
			FileOutputStream out = null;

			try {
				in = multipartFile.getInputStream();
				out = new FileOutputStream(new File(realPath
						+ System.getProperty("file.separator") + fileName));

				byte[] b;
				for (boolean mv = true; mv; b = (byte[]) null) {
					b = new byte[1024];
					int num = in.read(b);
					if (num > -1) {
						out.write(b);
					} else {
						mv = false;
					}
				}
			} finally {
				try {
					if (in != null) {
						in.close();
					}
				} catch (Exception arg21) {
					;
				}

				try {
					if (out != null) {
						out.close();
					}
				} catch (Exception arg20) {
					;
				}

			}

			ModelAndView mv1 = new ModelAndView(
					"redirect:/ModalDialogSuccess.ihtm");
			mv1.addObject("returnValue", uploadPath + fileName);
			return mv1;
		} else {
			uploadPath = "请选择要上传的文件";
			EncCommonHelper.setAlertMessage(request, uploadPath);
			realPath = request.getParameter("from_url");
			return new ModelAndView("redirect:" + realPath);
		}
	}

	public ModelAndView handleHtml5Upload(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		String allowExist = "1";
		HashMap map = new HashMap();

		try {
			String mapper = request.getParameter("comm_type");
			boolean json = false;
			String out = "";
			if (mapper != null) {
				String signId = request.getParameter("sign_id");
				String uploadPath = EncCommonHelper.getUploadVirtualPath(this
						.getServletContext());
				String realPath = this.getServletContext().getRealPath(
						uploadPath);
				String tmpFn = signId + ".tmp";
				File arg30;
				if (mapper.equals("INIT")) {
					boolean arg27 = true;
					String arg29;
					if (!allowExist.equals("1")) {
						arg29 = request.getParameter("file_name");
						arg30 = new File(realPath
								+ System.getProperty("file.separator") + arg29);
						if (arg30.exists()) {
							arg27 = false;
						}
					}

					if (!arg27) {
						json = false;
						out = "文件名已经存在！";
					} else {
						arg29 = request.getParameter("file_size");
						RandomAccessFile arg33 = new RandomAccessFile(realPath
								+ System.getProperty("file.separator") + tmpFn,
								"rw");
						arg33.setLength(Long.parseLong(arg29));
						arg33.close();
						json = true;
					}
				} else {
					String fileName;
					if (mapper.equals("DATA")) {
						fileName = request.getParameter("data_inde");
						MultipartHttpServletRequest arg28 = (MultipartHttpServletRequest) request;
						MultipartFile arg31 = arg28.getFile("data");
						RandomAccessFile arg32 = null;

						try {
							arg32 = new RandomAccessFile(realPath
									+ System.getProperty("file.separator")
									+ tmpFn, "rw");
							arg32.seek(Long.parseLong(fileName));
							arg32.write(arg31.getBytes());
							arg32.close();
							json = true;
						} finally {
							try {
								arg32.close();
							} catch (Exception arg21) {
								;
							}

						}
					} else if (mapper.equals("END")) {
						fileName = request.getParameter("file_name");
						File targetFile = new File(realPath
								+ System.getProperty("file.separator")
								+ fileName);
						if (!allowExist.equals("1") && targetFile.exists()) {
							json = false;
							out = "文件名已经存在！";
						} else {
							if (allowExist.equals("1")) {
								int tmpFile = 0;
								int lastIndex = fileName.lastIndexOf(".");
								String partName = fileName;
								String extendName = "";
								if (lastIndex != -1) {
									extendName = fileName
											.substring(lastIndex + 1);
									partName = fileName.substring(0, lastIndex);
								}

								while (targetFile.exists()) {
									++tmpFile;
									fileName = partName + "(" + tmpFile + ")."
											+ extendName;
									targetFile = new File(
											realPath
													+ System.getProperty("file.separator")
													+ fileName);
								}
							}

							arg30 = new File(realPath
									+ System.getProperty("file.separator")
									+ tmpFn);
							arg30.renameTo(targetFile);
							map.put("fileUrl", uploadPath + fileName);
							json = true;
						}
					}
				}
			} else {
				out = "COMM_TYPE_ERR";
			}

			if (json) {
				map.put("status", "OK");
			} else {
				map.put("status", "ERROR");
				map.put("errMsg", out);
			}
		} catch (Exception arg23) {
			arg23.printStackTrace();
			map.put("status", "ERROR");
			map.put("errMsg", arg23.toString());
		}

		ObjectMapper arg24 = new ObjectMapper();
		String arg25 = arg24.writeValueAsString(map);
		ServletOutputStream arg26 = response.getOutputStream();
		arg26.write(arg25.getBytes("utf-8"));
		arg26.flush();
		arg26.close();
		return null;
	}

	public ModelAndView handleAppFileUpload(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		response.setContentType("text/plain");
		response.setCharacterEncoding("utf-8");
		response.setHeader("Cache-Control", "no-cache");
		response.setHeader("Pragma", "no-cache");
		String allowExist = "1";
		HashMap map = new HashMap();

		try {
			String mapper = request.getParameter("comm_type");
			boolean json = false;
			String out = "";
			if (mapper != null && mapper.equals("EKING")) {
				String fileName = request.getParameter("file_name");
				String uploadPath = EncCommonHelper.getUploadVirtualPath(this
						.getServletContext());
				String realPath = this.getServletContext().getRealPath(
						uploadPath);
				File targetFile = new File(realPath
						+ System.getProperty("file.separator") + fileName);
				if (!allowExist.equals("1") && targetFile.exists()) {
					json = false;
					out = "文件名已经存在！";
				} else if (allowExist.equals("1")) {
					int multipartRequest = 0;
					int multipartFile = fileName.lastIndexOf(".");
					String partName = fileName;
					String extendName = "";
					if (multipartFile != -1) {
						extendName = fileName.substring(multipartFile + 1);
						partName = fileName.substring(0, multipartFile);
					}

					while (targetFile.exists()) {
						++multipartRequest;
						fileName = partName + "(" + multipartRequest + ")."
								+ extendName;
						targetFile = new File(realPath
								+ System.getProperty("file.separator")
								+ fileName);
					}
				}

				MultipartHttpServletRequest arg19 = (MultipartHttpServletRequest) request;
				MultipartFile arg20 = arg19.getFile("uplo_file");
				if (arg20 != null && !arg20.isEmpty()) {
					FileCopyUtils.copy(arg20.getBytes(), new File(realPath
							+ System.getProperty("file.separator") + fileName));
					out = uploadPath + fileName;
					json = true;
				} else {
					out = "paras error:uplo_file is empty";
				}
			} else {
				out = "paras error:comm_type=" + mapper;
			}

			if (json) {
				map.put("status", "OK");
				map.put("fileUrl", out);
			} else {
				map.put("status", "ERROR");
				map.put("errMsg", out);
			}
		} catch (Exception arg15) {
			arg15.printStackTrace();
			map.put("status", "ERROR");
			map.put("errMsg", arg15.toString());
		}

		ObjectMapper arg16 = new ObjectMapper();
		String arg17 = arg16.writeValueAsString(map);
		ServletOutputStream arg18 = response.getOutputStream();
		arg18.write(arg17.getBytes("utf-8"));
		arg18.flush();
		arg18.close();
		return null;
	}

	public ModelAndView handleImpoSuccess(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return new ModelAndView(this.impoSuccessView);
	}

	public ModelAndView handleOnlineLoginBridge(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String forwardAction = request.getParameter("signonForwardUrl");
		return (new ModelAndView(this.onlineLoginBridgeView)).addObject(
				"signonForwardUrl", forwardAction);
	}

	public ModelAndView handleOnlineMain(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ClieUserBean ub = EncCommonHelper.getClieUserAccount(request);
		BigDecimal remaCost = this.businessBillDao.getReceivableCost(ub
				.getUser().getClieId(), 0L);
		remaCost = (new BigDecimal(0)).subtract(remaCost);
		return (new ModelAndView(this.onlineMainView)).addObject("remaCost",
				remaCost);
	}

	public ModelAndView handleOnlineDesktop(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return new ModelAndView(this.onlineDesktopView);
	}

	public ModelAndView handleOnlineLogout(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		EncCommonHelper.setClieUserAccount(request, (ClieUserBean) null);
		return new ModelAndView("redirect:/online/Login.ihtm");
	}

	public ModelAndView handleCutImgForm(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return new ModelAndView(this.cutImgFormView);
	}

	public String getFootView() {
		return this.footView;
	}

	public void setFootView(String footView) {
		this.footView = footView;
	}

	public String getLeftMenuView() {
		return this.leftMenuView;
	}

	public void setLeftMenuView(String leftMenuView) {
		this.leftMenuView = leftMenuView;
	}

	public String getMainView() {
		return this.mainView;
	}

	public void setMainView(String mainView) {
		this.mainView = mainView;
	}

	public String getTopMenuView() {
		return this.topMenuView;
	}

	public void setTopMenuView(String topMenuView) {
		this.topMenuView = topMenuView;
	}

	public String getLoginBridgeView() {
		return this.loginBridgeView;
	}

	public void setLoginBridgeView(String loginBridgeView) {
		this.loginBridgeView = loginBridgeView;
	}

	public String getLogoutView() {
		return this.logoutView;
	}

	public void setLogoutView(String logoutView) {
		this.logoutView = logoutView;
	}

	public String getSystemMainView() {
		return this.systemMainView;
	}

	public void setSystemMainView(String systemMainView) {
		this.systemMainView = systemMainView;
	}

	public String getModalDialogView() {
		return this.modalDialogView;
	}

	public void setModalDialogView(String modalDialogView) {
		this.modalDialogView = modalDialogView;
	}

	public String getModalDialogSuccessView() {
		return this.modalDialogSuccessView;
	}

	public void setModalDialogSuccessView(String modalDialogSuccessView) {
		this.modalDialogSuccessView = modalDialogSuccessView;
	}

	public String getCalendarSelectView() {
		return this.calendarSelectView;
	}

	public void setCalendarSelectView(String calendarSelectView) {
		this.calendarSelectView = calendarSelectView;
	}

	public BbsArticleDao getBbsArticleDao() {
		return this.bbsArticleDao;
	}

	public void setBbsArticleDao(BbsArticleDao bbsArticleDao) {
		this.bbsArticleDao = bbsArticleDao;
	}

	public BbsColumnDao getBbsColumnDao() {
		return this.bbsColumnDao;
	}

	public void setBbsColumnDao(BbsColumnDao bbsColumnDao) {
		this.bbsColumnDao = bbsColumnDao;
	}

	public MessageDao getMessageDao() {
		return this.messageDao;
	}

	public void setMessageDao(MessageDao messageDao) {
		this.messageDao = messageDao;
	}

	public String getOnlineListView() {
		return this.onlineListView;
	}

	public void setOnlineListView(String onlineListView) {
		this.onlineListView = onlineListView;
	}

	public String getBusinessMainView() {
		return this.businessMainView;
	}

	public void setBusinessMainView(String businessMainView) {
		this.businessMainView = businessMainView;
	}

	public String getBaseMainView() {
		return this.baseMainView;
	}

	public void setBaseMainView(String baseMainView) {
		this.baseMainView = baseMainView;
	}

	public String getFinanceMainView() {
		return this.financeMainView;
	}

	public void setFinanceMainView(String financeMainView) {
		this.financeMainView = financeMainView;
	}

	public String getMakeMainView() {
		return this.makeMainView;
	}

	public void setMakeMainView(String makeMainView) {
		this.makeMainView = makeMainView;
	}

	public String getSpellSelectView() {
		return this.spellSelectView;
	}

	public void setSpellSelectView(String spellSelectView) {
		this.spellSelectView = spellSelectView;
	}

	public EnterpriseInfoDao getEnterpriseInfoDao() {
		return this.enterpriseInfoDao;
	}

	public void setEnterpriseInfoDao(EnterpriseInfoDao enterpriseInfoDao) {
		this.enterpriseInfoDao = enterpriseInfoDao;
	}

	public String getStorehouseMainView() {
		return this.storehouseMainView;
	}

	public void setStorehouseMainView(String storehouseMainView) {
		this.storehouseMainView = storehouseMainView;
	}

	public String getPurchaseMainView() {
		return this.purchaseMainView;
	}

	public void setPurchaseMainView(String purchaseMainView) {
		this.purchaseMainView = purchaseMainView;
	}

	public String getCooperMainView() {
		return this.cooperMainView;
	}

	public void setCooperMainView(String cooperMainView) {
		this.cooperMainView = cooperMainView;
	}

	public String getSmsMainView() {
		return this.smsMainView;
	}

	public void setSmsMainView(String smsMainView) {
		this.smsMainView = smsMainView;
	}

	public IdGenerator getIdGenerator() {
		return this.idGenerator;
	}

	public void setIdGenerator(IdGenerator idGenerator) {
		this.idGenerator = idGenerator;
	}

	public String getSystemLogListView() {
		return this.systemLogListView;
	}

	public void setSystemLogListView(String systemLogListView) {
		this.systemLogListView = systemLogListView;
	}

	public QueryDao getQueryDao() {
		return this.queryDao;
	}

	public void setQueryDao(QueryDao queryDao) {
		this.queryDao = queryDao;
	}

	public DepartmentDao getDepartmentDao() {
		return this.departmentDao;
	}

	public void setDepartmentDao(DepartmentDao departmentDao) {
		this.departmentDao = departmentDao;
	}

	public EstablishmentCommunicateDao getEstablishmentCommunicateDao() {
		return this.establishmentCommunicateDao;
	}

	public void setEstablishmentCommunicateDao(
			EstablishmentCommunicateDao establishmentCommunicateDao) {
		this.establishmentCommunicateDao = establishmentCommunicateDao;
	}

	public SystemLogDao getSystemLogDao() {
		return this.systemLogDao;
	}

	public void setSystemLogDao(SystemLogDao systemLogDao) {
		this.systemLogDao = systemLogDao;
	}
}